﻿package tests;
import flash.events.Event;
import mclight.utils.FrameUtil;

class FrameUtilTest extends GenericTest
{
	public function new() 
	{
		super();
	}
	
	override function init()
	{
		FrameUtil.add(onFrame0);
		FrameUtil.add(onFrame1);
		addEventListener(Event.ENTER_FRAME, onEnterFrame);
	}
	
	function onEnterFrame(e:Event)
	{
		tracer('enter frame');
	}
	
	function onFrame0()
	{
		trace('0');
		FrameUtil.add(callback(tracer, '\t00'));
		FrameUtil.add(callback(tracer, '\t01'));
		FrameUtil.add(callback(tracer, '\t02'));
	}
	
	function onFrame1()
	{
		trace('1');
		FrameUtil.add(callback(tracer, '\t10'));
		FrameUtil.add(callback(tracer, '\t11'));
		FrameUtil.add(callback(tracer, '\t12'));
		FrameUtil.add(onFrame13);
	}
	
	function onFrame13()
	{
		trace('\t13');
		FrameUtil.add(callback(tracer, '\t\t130'));
		FrameUtil.add(callback(removeEventListener, Event.ENTER_FRAME, onEnterFrame, false));
	}
	
	function tracer(value:String)
	{
		trace(value);
	}
}